# -*- coding: utf-8 -*-
# © 2018 QYT Technology
# Authored by: Zhao Xingtao (zxt50330@gmail.com)


from flask import Flask

from bills.utils.json_encoder import CustomJSONEncoder
from bills.services.model import db
from bills.services.schema import ma
from bills.debt import debt as debt_blueprint


def create_app(config_filename='settings/development.py'):
    app = Flask(__name__)
    app.config.from_pyfile(config_filename)

    db.init_app(app)

    app.register_blueprint(debt_blueprint)

    app.json_encoder = CustomJSONEncoder
    return app